<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE Trustworthy #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# LANGUAGE NoImplicitPrelude
           , RankNTypes
           , ExistentialQuantification
  #-}</span><span>
</span><span id="line-6"></span><span class="hs-pragma">{-# OPTIONS_HADDOCK not-home #-}</span><span>
</span><span id="line-7"></span><span>
</span><span id="line-8"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-9"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-10"></span><span class="hs-comment">-- Module      :  GHC.Desugar</span><span>
</span><span id="line-11"></span><span class="hs-comment">-- Copyright   :  (c) The University of Glasgow, 2007</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- License     :  see libraries/base/LICENSE</span><span>
</span><span id="line-13"></span><span class="hs-comment">--</span><span>
</span><span id="line-14"></span><span class="hs-comment">-- Maintainer  :  cvs-ghc@haskell.org</span><span>
</span><span id="line-15"></span><span class="hs-comment">-- Stability   :  internal</span><span>
</span><span id="line-16"></span><span class="hs-comment">-- Portability :  non-portable (GHC extensions)</span><span>
</span><span id="line-17"></span><span class="hs-comment">--</span><span>
</span><span id="line-18"></span><span class="hs-comment">-- Support code for desugaring in GHC</span><span>
</span><span id="line-19"></span><span class="hs-comment">--</span><span>
</span><span id="line-20"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-21"></span><span>
</span><span id="line-22"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.Desugar</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Desugar.html#%3E%3E%3E"><span class="hs-operator">(&gt;&gt;&gt;)</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Desugar.html#AnnotationWrapper"><span class="hs-identifier">AnnotationWrapper</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Desugar.html#toAnnotationWrapper"><span class="hs-identifier">toAnnotationWrapper</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-23"></span><span>
</span><span id="line-24"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Control.Arrow.html"><span class="hs-identifier">Control.Arrow</span></a></span><span>    </span><span class="hs-special">(</span><span class="annot"><a href="Control.Arrow.html#Arrow"><span class="hs-identifier">Arrow</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-25"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Control.Category.html"><span class="hs-identifier">Control.Category</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Category.html#."><span class="hs-operator">(.)</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-26"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Data.html"><span class="hs-identifier">Data.Data</span></a></span><span>        </span><span class="hs-special">(</span><span class="annot"><a href="Data.Data.html#Data"><span class="hs-identifier">Data</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-27"></span><span>
</span><span id="line-28"></span><span class="hs-comment">-- A version of Control.Category.&gt;&gt;&gt; overloaded on Arrow</span><span>
</span><span id="line-29"></span><span class="annot"><a href="GHC.Desugar.html#%3E%3E%3E"><span class="hs-operator hs-type">(&gt;&gt;&gt;)</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621679577107"><span class="annot"><a href="#local-6989586621679577107"><span class="hs-identifier hs-type">arr</span></a></span></span><span class="hs-operator">.</span><span> </span><span class="annot"><a href="Control.Arrow.html#Arrow"><span class="hs-identifier hs-type">Arrow</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679577107"><span class="hs-identifier hs-type">arr</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621679577105"><span class="annot"><a href="#local-6989586621679577105"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span id="local-6989586621679577104"><span class="annot"><a href="#local-6989586621679577104"><span class="hs-identifier hs-type">b</span></a></span></span><span> </span><span id="local-6989586621679577103"><span class="annot"><a href="#local-6989586621679577103"><span class="hs-identifier hs-type">c</span></a></span></span><span class="hs-operator">.</span><span> </span><span class="annot"><a href="#local-6989586621679577107"><span class="hs-identifier hs-type">arr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679577105"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679577104"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679577107"><span class="hs-identifier hs-type">arr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679577104"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679577103"><span class="hs-identifier hs-type">c</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679577107"><span class="hs-identifier hs-type">arr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679577105"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679577103"><span class="hs-identifier hs-type">c</span></a></span><span>
</span><span id="line-30"></span><span class="hs-comment">-- NB: the type of this function is the &quot;shape&quot; that GHC expects</span><span>
</span><span id="line-31"></span><span class="hs-comment">--     in tcInstClassOp.  So don't put all the foralls at the front!</span><span>
</span><span id="line-32"></span><span class="hs-comment">--     Yes, this is a bit grotesque, but heck it works and the whole</span><span>
</span><span id="line-33"></span><span class="hs-comment">--     arrows stuff needs reworking anyway!</span><span>
</span><span id="line-34"></span><span id="local-6989586621679577083"><span class="annot"><span class="annottext">arr a b
</span><a href="#local-6989586621679577083"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="%3E%3E%3E"><span class="annot"><span class="annottext">&gt;&gt;&gt; :: forall (arr :: * -&gt; * -&gt; *) a b c.
Arrow arr =&gt;
arr a b -&gt; arr b c -&gt; arr a c
</span><a href="GHC.Desugar.html#%3E%3E%3E"><span class="hs-operator hs-var hs-var">&gt;&gt;&gt;</span></a></span></span><span> </span><span id="local-6989586621679577082"><span class="annot"><span class="annottext">arr b c
</span><a href="#local-6989586621679577082"><span class="hs-identifier hs-var">g</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">arr b c
</span><a href="#local-6989586621679577082"><span class="hs-identifier hs-var">g</span></a></span><span> </span><span class="annot"><span class="annottext">arr b c -&gt; arr a b -&gt; arr a c
forall {k} (cat :: k -&gt; k -&gt; *) (b :: k) (c :: k) (a :: k).
Category cat =&gt;
cat b c -&gt; cat a b -&gt; cat a c
</span><a href="Control.Category.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">arr a b
</span><a href="#local-6989586621679577083"><span class="hs-identifier hs-var">f</span></a></span><span>
</span><span id="line-35"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">&gt;&gt;&gt;</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="hs-comment">-- see Note [INLINE on &gt;&gt;&gt;] in Control.Category</span><span>
</span><span id="line-36"></span><span>
</span><span id="line-37"></span><span class="hs-comment">-- A wrapper data type that lets the typechecker get at the appropriate dictionaries for an annotation</span><span>
</span><span id="line-38"></span><span class="hs-keyword">data</span><span> </span><span id="AnnotationWrapper"><span class="annot"><a href="GHC.Desugar.html#AnnotationWrapper"><span class="hs-identifier hs-var">AnnotationWrapper</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621679577081"><span class="annot"><a href="#local-6989586621679577081"><span class="hs-identifier hs-type">a</span></a></span></span><span class="hs-operator">.</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Data.html#Data"><span class="hs-identifier hs-type">Data</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679577081"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span id="AnnotationWrapper"><span class="annot"><a href="GHC.Desugar.html#AnnotationWrapper"><span class="hs-identifier hs-var">AnnotationWrapper</span></a></span></span><span> </span><span class="annot"><a href="#local-6989586621679577081"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-39"></span><span>
</span><span id="line-40"></span><span id="local-6989586621679577091"><span class="annot"><a href="GHC.Desugar.html#toAnnotationWrapper"><span class="hs-identifier hs-type">toAnnotationWrapper</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Data.html#Data"><span class="hs-identifier hs-type">Data</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679577091"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679577091"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Desugar.html#AnnotationWrapper"><span class="hs-identifier hs-type">AnnotationWrapper</span></a></span></span><span>
</span><span id="line-41"></span><span id="toAnnotationWrapper"><span class="annot"><span class="annottext">toAnnotationWrapper :: forall a. Data a =&gt; a -&gt; AnnotationWrapper
</span><a href="GHC.Desugar.html#toAnnotationWrapper"><span class="hs-identifier hs-var hs-var">toAnnotationWrapper</span></a></span></span><span> </span><span id="local-6989586621679577077"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679577077"><span class="hs-identifier hs-var">what</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; AnnotationWrapper
forall a. Data a =&gt; a -&gt; AnnotationWrapper
</span><a href="GHC.Desugar.html#AnnotationWrapper"><span class="hs-identifier hs-var">AnnotationWrapper</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679577077"><span class="hs-identifier hs-var">what</span></a></span><span>
</span><span id="line-42"></span></pre></body></html>